package com.jinly.ryder;


import com.jinly.ryder.account.config.AuthProperties;
import com.jinly.ryder.ansible.config.AnsibleProperties;
import com.jinly.ryder.build.config.BuildProperties;
import com.jinly.ryder.manage.config.SecretProperties;
import com.jinly.ryder.monitor.config.MonitorProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

@EnableAsync
@EnableScheduling
@SpringBootApplication
@EnableConfigurationProperties({
        BuildProperties.class,
        AnsibleProperties.class,
        AuthProperties.class,
        SecretProperties.class,
        MonitorProperties.class,
})
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Bean
    public TaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler scheduling = new ThreadPoolTaskScheduler();
        scheduling.setPoolSize(10);
        scheduling.initialize();
        return scheduling;
    }

}
